<?php
namespace App\Http\Controllers\H5fuwu;

use App\Http\Controllers\Controller;
use App\Services\H5fuwu\FuwuService;
use Illuminate\Http\Request;

class FuwuController extends Controller
{
    //服务

    public function __construct(FuwuService $service)
    {
        $this->db = $service;
    }

    //列表
    public function getList(Request $request)
    {
        $res = $this->db->getList();
        if ($res['code'] < 0) {
            return $this->toJson(-2, $res['msg']);
        }
        return $this->toJson(0, '', $res['data']);
    }

    //家政日常
    public function dayList(Request $request)
    {
        $res = $this->db->jzday();
        if ($res['code'] < 0) {
            return $this->toJson(-2, $res['msg']);
        }
        return $this->toJson(0, '', $res['data']);
    }

    //家政图片
    public function imgList(Request $request)
    {
        $day = $request->post('day', '');
        $res = $this->db->jzimg($day);
        if ($res['code'] < 0) {
            return $this->toJson(-2, $res['msg']);
        }
        return $this->toJson(0, '', $res['data']);
    }
}